From: Marco Trevisan (TreviƱo) Date: Sat, 28 Oct 2017 07:23:02 +0000 (-0500) Subject: status/keyboard: Reset menuItems and Label objects on change X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~994^2^2~151 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=a46af9edf0b99b64501617a1159bc1beb9af218f;p=gnome-shell.git status/keyboard: Reset menuItems and Label objects on change In the current code it could happen that we've menuItems and indicatorLabels for sources that aren't anymore around, because in case a source is removed we don't cleanup the their container objects. Also, we should nullify InputManager's _currentSource when sources change or it might point to some invalid data again. So it could happen that we try to access an invalid menuitem or label if a source change happens mentioning a source that has been deleted. https://bugzilla.gnome.org/show_bug.cgi?id=788931 --- diff --git a/js/ui/status/keyboard.js b/js/ui/status/keyboard.js index 70e6abf87..b2f10322d 100644 --- a/js/ui/status/keyboard.js +++ b/js/ui/status/keyboard.js @@ -529,6 +529,7 @@ var InputSourceManager = new Lang.Class({ let sources = this._settings.inputSources; let nSources = sources.length; + this._currentSource = null; this._inputSources = {}; this._ibusSources = {}; @@ -827,6 +828,9 @@ var InputSourceIndicator = new Lang.Class({ for (let i in this._indicatorLabels) this._indicatorLabels[i].destroy(); + this._menuItems = {}; + this._indicatorLabels = {}; + let menuIndex = 0; for (let i in this._inputSourceManager.inputSources) { let is = this._inputSourceManager.inputSources[i];